# coding=utf-8

from mysql import UsingMysql
import time

class SpiderMonitor:
    '''
    进度监控 Model
    @author Woody
    @date 2021.12.18
    '''
    #表名
    __table_name = 'ai_spider_monitor'

    def __init__(self) -> None:
        pass

    # 保存已采位置
    def save(self, title, status):

        with UsingMysql(log_time=False) as um:

            sql = "UPDATE `"+self.__table_name +"` SET `status`=%s where `title`=%s"

            sql = sql % (
            um._conn.escape(status),
            #time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())),
            um._conn.escape(title))

            um.cursor.execute(sql)

